public class TreeNode {

    public Integer value;
    public TreeNode left;
    public   TreeNode right;

    public TreeNode(Integer value, TreeNode left, TreeNode right) {
        this.value = value;
        this.left = left;
        this.right = right;
    }

    public TreeNode() {
    }
    public TreeNode(Integer value) {
        this.value=value;
        this.left=null;
        this.right=null;
    }

    //后序遍历的方式
    public TreeNode invertTree(TreeNode root) {
        if (root==null){
            return null;
        }
        TreeNode left=invertTree(root.left);
        TreeNode right=invertTree(root.right);
        root.left=right;
        root.right=left;
        return root;
        //反转二叉树
    }

//    public boolean isSymmetric(TreeNode root) {
//         return checkOut(root.left,root.right);
//    }
//    public  boolean checkOut(TreeNode p,TreeNode q){
//        if (q==null&&p==null){
//            return true;
//        }
//        if (p==null||q==null){
//            return false;
//        }
//        return p.val==q.val&&checkOut(p.left,q.right)&&checkOut(p.right,q.left);
//    }
}
